package com.inxedu.os.edu.service.images.Impl.Images;

import com.inxedu.os.edu.dao.Images.EduWebsiteImagesTypeMapper;
import com.inxedu.os.edu.pojo.EduWebsiteImagesType;
import com.inxedu.os.edu.pojo.EduWebsiteImagesTypeExample;
import com.inxedu.os.edu.service.images.ImageTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ImageTypeServiceImpl implements ImageTypeService {

    @Autowired
   private EduWebsiteImagesTypeMapper eduWebsiteImagesTypeMapper;

    @Override
    public int delImageType(int id) {
        EduWebsiteImagesTypeExample example = new EduWebsiteImagesTypeExample();
        EduWebsiteImagesTypeExample.Criteria criteria = example.createCriteria();
        criteria.andTypeIdEqualTo(id);
        return eduWebsiteImagesTypeMapper.deleteByExample(example);
    }

    @Override
    public int updateImageTypeName(EduWebsiteImagesType eduWebsiteImagesType) {
        return eduWebsiteImagesTypeMapper.updateByPrimaryKey(eduWebsiteImagesType);
    }

    @Override
    public List<EduWebsiteImagesType> getAllImages() {
        EduWebsiteImagesTypeExample example = new EduWebsiteImagesTypeExample();
        return eduWebsiteImagesTypeMapper.selectByExample(example);
    }

    @Override
    public void addImageType(EduWebsiteImagesType eduWebsiteImagesType) {
        eduWebsiteImagesTypeMapper.insert(eduWebsiteImagesType);
    }

}
